﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.UI;
using UnityEngine;
namespace Miao
{
    public class State : IState
    {
        //状态带有自己
        public string Name { get; private set; }
        public FSM FSM { get; private set; }

        public State()
        {
            Name = GetType().Name;
        }

        public virtual void Init(FSM fsm)
        {
            FSM = fsm;
        }
        protected virtual void ChangeState<T>() where T : class, IState
        {
            FSM.ChangeState<T>();
        }

        public virtual bool Reason() { return false; }
        public virtual void OnUpdateState(float deltaTime) { }
        public virtual void OnFixedUpdateState(float fixedDeltaTime) { }
        public virtual void OnStayState() { }
        public virtual void OnExitState() { }
    }




    public interface IState
    {
        void Init(FSM fsm);
        bool Reason();
        void OnUpdateState(float deltaTime);
        void OnFixedUpdateState(float fixedDeltaTime);
        void OnStayState();
        void OnExitState();
        string Name { get; }
    }
}

